﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using System.Web.Services;
using System.Text;
using System.IO;

public partial class Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["url_back"] = Request.RawUrl;
            LoadSeo();
        }
    }
    [WebMethod]
    public static string LoadControl(int type)
    {
        StringBuilder htmlResponse = new StringBuilder();
        using (StringWriter sw = new StringWriter(htmlResponse))
        {
            using (HtmlTextWriter textWriter = new HtmlTextWriter(sw))
            {
                UserControl myControl = new UserControl();
                UserControls_Category cl = (UserControls_Category)myControl.LoadControl("~/UserControls/Category.ascx");
                cl.pages = type;
                cl.RenderControl(textWriter);
            }
        }
        return htmlResponse.ToString();
    }
    private void LoadSeo()
    {
        try
        {
            //Load SEO
            ConfigBLL data = new ConfigBLL();
            var config = data.GetDefautl();

            //description.Content = config.Description;
            //copyright.Content = config.Copyright;
            //author.Content = config.Author;
            //keywords.Content = config.Keywords;

            //ltTitle.Text = config.Keywords;
        }
        catch { }
    }
}